﻿@model WeProjects.Models.NewsModel

@{
    ViewBag.Title = "Edit";
}
<style type="text/css">
    table {
        width: 90% !important;
    }
</style>

<h2>编辑新闻</h2>
<p class="buttonIn">
    @Html.ActionLink("返回列表", "Index")
</p>

<div>
    <img src=@Model.ImageData />
</div>
@using (Html.BeginForm("Edit", "News", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>

        @Html.HiddenFor(model => model.ID)
        @Html.HiddenFor(model => model.ProjectID)
        @Html.HiddenFor(model => model.isPublic)
        @Html.HiddenFor((model => model.isPublished))

        <div class="form-group">
            <label class="control-label width-40p">@Html.LabelFor(model => model.Title, "标题")</label>
            @Html.EditorFor(model => model.Title)
            @Html.ValidationMessageFor(model => model.Title)
        </div>
        <div class="form-group">
            <label class="control-label width-40p">标签</label>
            @for (int x = 0; x < Model.Tags.Count; x++)
            {
                <span style="padding-right:10px;">
                    @Html.CheckBoxFor(t => Model.Tags[x].Selected) @Model.Tags[x].Name
                    @Html.Hidden("Tags[" + x + "].Name", Model.Tags[x].Name)
                    @Html.Hidden("Tags[" + x + "].Code", Model.Tags[x].Code)
                </span>
            }
        </div>
        <div class="form-group">
            <label class="control-label width-40p" style="vertical-align:top;">@Html.LabelFor(model => model.NewsContent, "内容")</label>
            <div style="display:inline-block;overflow:hidden;zoom:1;width:90%">
                @Html.EditorFor(model => model.NewsContent)
                @Html.ValidationMessageFor(model => model.NewsContent)
            </div>
        </div>

        @*<div class="editor-label">
            @Html.LabelFor(model => model.PublishDate)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.PublishDate)
            @Html.ValidationMessageFor(model => model.PublishDate)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ProjectID)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ProjectID)
            @Html.ValidationMessageFor(model => model.ProjectID)
        </div>*@

        @*<div class="editor-label">
            @Html.LabelFor(model => model.isPublic)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.isPublic)
            @Html.ValidationMessageFor(model => model.isPublic)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.isPublished)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.isPublished)
            @Html.ValidationMessageFor(model => model.isPublished)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.MemberID)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.MemberID)
            @Html.ValidationMessageFor(model => model.MemberID)
        </div>*@
        <div class="form-group">
            <label class="control-label width-40p" style="vertical-align:top;">题图</label>
            <div style="display:inline-block;overflow:hidden;zoom:1;width:90%">
                <input type="file" name="file" value="Upload" />
            </div>
        </div>

        <div class="form-group">
            <label class="control-label width-40p"></label>
            <input type="submit" value="保存" class="btn btn-success" />
        </div>
    </fieldset>
}
